package com.example;

public class StudentAdvanced {

    private String name;

    private Grade grade;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Grade getGrade() {
        return grade;
    }

    public void setGrade(Grade grade) {
        this.grade = grade;
    }

    public enum Grade {
        A("100~90") {
            @Override
            public String toLocaleString() {
                return "优秀";
            }
        }, B("89~80") {
            @Override
            public String toLocaleString() {
                return "良好";
            }
        }, C("79~70") {
            @Override
            public String toLocaleString() {
                return "一般";
            }
        }, D("69~60") {
            @Override
            public String toLocaleString() {
                return "刚及格";
            }
        }, E("59~0") {
            @Override
            public String toLocaleString() {
                return "不及格";
            }
        };

        private String value;

        // 枚举中定义构造函数
        Grade(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }

        // 枚举中定义抽象方法
        public abstract String toLocaleString();
    }

}


